package com.xja.book.Controller;

import com.sun.org.apache.regexp.internal.RE;
import com.xja.book.entity.Booktype;
import com.xja.book.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("bookType")
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;
    @RequestMapping("find")
    public  String find(Model model){
        try {
            List<Booktype> booktypeList = bookTypeService.booktypes();
            model.addAttribute("booktypeList",booktypeList);
            return "type_list";

        }catch (Exception e){
            e.printStackTrace();
        }
        return "redirect:/error.jsp";
    }
}
